<template>
  <div>
    <el-row>
      <el-col :span="24">提示信息</el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <div class="tsxx-wrpa">
          <div v-for="(item, i) in tiShiInfo" :key="item.MESSAGE">({{ item.REMIND_ID }}) {{ item.MESSAGE }}</div>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="tablewrap">
          <FilterTable :columns="columns" :isColumnFilter="false" :dataSource="dataSource" :height="200" :onColumnsChange="columns => (this.columns = columns)"></FilterTable>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import moment from 'moment';
import { retriveByControl, retriveByControlright } from '@/api/repair/repairReception/customer/monitoring.js';

export default {
  name: 'TiShiXinXi',
  props: {
    queryParams: Object
  },
  data() {
    return {
      // 提示信息
      tiShiInfo: [],
      // 提示信息 监控表格
      dataSource: [],
      columns: this.createColumnsMonitoring()
    };
  },
  mounted() {
    this.retriveByControl();
    this.retriveByControlright();
  },
  methods: {
    // 查询提示信息
    async retriveByControl() {
      const params = {
        // engineNo: '2564156',
        // MODEL: 'WSPAD-TB5-2016-LincolnNavigatorCHN-YZBCA',
        // SERIES: 'WSPAD-TB5-2016-LincolnNavigatorCHN',
        // RONO: 'RO1901190001',
        ...this.queryParams
        // ownerNo: 'OW1812180006',
        // isRepairOrder: 'REPAIR_ORDER_TAG',
        // vin: 'NJDSVNSDJV2564156',
        // dmsFuncId: '35100010',
        // LICENSE: '黑A33333',
        // BRAND: 'LINCOLN',
        // MILEAGE: '50000',
        // createDate: '2019-01-19 08:22',
        // _: '1567144192276'
      };
      const res = await retriveByControl(params);
      this.tiShiInfo = res.data;
      console.log('查询提示信息', params, res);
    },
    // 查询 监控信息
    async retriveByControlright() {
      const params = {
        sort: 'IS_VALID',
        order: 'asc',
        // engineNo: '2564156',
        // MODEL: 'WSPAD-TB5-2016-LincolnNavigatorCHN-YZBCA',
        // SERIES: 'WSPAD-TB5-2016-LincolnNavigatorCHN',
        // RONO: 'RO1901190001',
        ...this.queryParams
        // LICENSE: '黑A33333',
        // vin: 'NJDSVNSDJV2564156',
        // ownerNo: 'OW1812180006',
        // isRepairOrder: 'REPAIR_ORDER_TAG',
        // BRAND: 'LINCOLN',
        // MILEAGE: '50000',
        // createDate: '2019-01-19 08:22',
        // dmsFuncId: '35100010',
        // _: '1567144192282'
      };
      const res = await retriveByControlright(params);
      console.log('查询监控信息', params, res);
      this.dataSource = res.data;
    },
    createColumnsMonitoring() {
      return [
        {
          title: '序号',
          render: props => {
            return <span>{props.$index + 1}</span>;
          }
        },
        {
          title: '监控信息',
          dataIndex: 'MESSAGE'
        }
      ];
    }
  }
};
</script>

<style scoped></style>
